home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / pas / swag / crt.swg / 0006_Reading Keys.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  492b  |  29 lines

  1. {
  2. > Could someone please post an Asm equivalent of
  3. > Repeat Until KeyPressed;
  4.  
  5. Well, here it is using the Dos Unit instead of the Crt....  :)
  6. }
  7. Uses Dos;
  8. Var
  9.   r : Registers;
  10.  
  11. Function _ReadKey : Char;
  12. begin
  13.   r.ax := $0700;
  14.   intr($21, r);
  15.   _ReadKey := chr(r.al);
  16. end;
  17.  
  18. Function _KeyPressed : Boolean;
  19. begin
  20.   r.ax := $0b00;
  21.   intr($21,r);
  22.   if r.al = 255 then
  23.     _KeyPressed := True
  24.   else
  25.     _KeyPressed := False;
  26. end;
  27. begin
  28.   Repeat Until _keypressed;
  29. end.